package com.hqyj.css.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.hqyj.css.pojo.HqyjStu;
import com.hqyj.css.service.StuService;

@Controller
public class StuController {
	@Autowired
	StuService ss;
	@RequestMapping("listStu.cs")
	public String listStu(ModelMap map) {
		List<HqyjStu> list = ss.selectStu();
		map.put("hss", list);
		return "listStu";
	}
	@RequestMapping("delStu.cs")
	public String delStu(Integer stuCode) {
		ss.deleteStu(stuCode);
		return "redirect:listStu.cs";
	}
	@RequestMapping("toAddStu.cs")
	public String toAddStu() {
		return "addStu";
	}
	
	@RequestMapping("addStu.cs")
	public String addStu(HqyjStu hs) {
		ss.insertStu(hs);
		return "redirect:listStu.cs";
	}
	
	@RequestMapping("toUpdateStu.cs")
	public String toUpdateStu() {
		return "updateStu";
	}
	
	@RequestMapping("updateStu.cs")
	public String updateStu(HqyjStu hs) {
		ss.updateStu(hs);
		return "redirect:listStu.cs";
	}

}
